home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / game / role / ldmud-3.2-bin.lha / mud / doc / efun / allocate < prev    next >
Text File  |  2001-04-06  |  1KB  |  37 lines

  1. SYNOPSIS
  2.         mixed *allocate(int size)
  3.         mixed *allocate(int size, mixed init_value)
  4.  
  5.         mixed *allocate(int* sizes)
  6.         mixed *allocate(int* sizes, mixed init_value)
  7.  
  8. DESCRIPTION
  9.         Allocate an array of size elements. The number of elements
  10.         must be >= 0 and not bigger than a system maximum (usually
  11.         1000). If <init_value> is given, all array elements will be set
  12.         to this value, otherwise they all will be 0.
  13.  
  14.         In the second form (using an array of sizes instead of one size),
  15.         the efun will allocate a multidimensional array, that is an array
  16.         of arrays.
  17.  
  18.         Note that this function is hardly needed anymore, because
  19.         arrays can be added by the + operator, and can be constructed
  20.         and initialized by the ({ }) operator. The functions only
  21.         use is to construct big empty or initialized arrays.
  22.  
  23. EXAMPLE
  24.         string *buffer;
  25.         buffer = allocate(50);
  26.         buffer = allocate(50, "");
  27.  
  28.         buffer = allocate( ({ 2, 3 }) )
  29.           --> ({ ({ 0, 0, 0 }), ({ 0, 0, 0 }) })
  30.  
  31. HISTORY
  32.         LDMud 3.2.9 added the initialisation value and the multi-dimensional
  33.           allocation.
  34.  
  35. SEE ALSO
  36.         sizeof(E)
  37.